package models

import "gorm.io/gorm"

type User struct {
	gorm.Model
	Username string `gorm:"type:varchar(20)" json:"username"`
	Password string `gorm:"type:varchar(120)" json:"password"`
}

func (c *User) Register() error {
	return DB.Create(&c).Error
}
func (c *User) Login(username string) error {
	return DB.Where("username = ?", username).Limit(1).Find(&c).Error
}
